# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Jonathan Steel <jsteel@aur.archlinux.org>
# Contributor: Justin "juster" Davis <jrcd83@gmail.com>
# Contributor: François Charette <francois.archlinux.org>

pkgname=perl-xml-libxml
pkgver=2.0129
pkgrel=4
pkgdesc="Interface to the libxml library"
arch=('i686' 'x86_64')
url="http://search.cpan.org/dist/XML-LibXML"
license=('GPL')
depends=('libxml2' 'perl-xml-sax' 'perl-xml-namespacesupport')
checkdepends=('perl-test-pod' 'perl-test-leaktrace' 'perl-cpan-changes' 'perl-uri')
provides=('perl-libxml' 'perl-xml-libxml-common')
replaces=('perl-libxml' 'perl-xml-libxml-common')
options=('!emptydirs')
install=perl-xml-libxml.install
source=(http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-$pkgver.tar.gz)
md5sums=('5806b69d54a2d7884b8d22b395888436')

build() {
  cd "$srcdir"/XML-LibXML-$pkgver
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd "$srcdir"/XML-LibXML-$pkgver
  make test
}

package() {
  cd "$srcdir"/XML-LibXML-$pkgver
  make pure_install doc_install DESTDIR="$pkgdir"/
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
